package baseStructure;

/***
 * @author Ragnvald Fuglestein
 */

public class SearchTrack extends Search {
	private int num = -1;
	private SearchArtist searchartist = null;
	private SearchAlbum searchalbum = null;

	public SearchTrack(String name) {
		super(name);
	}
	
	public SearchTrack(String name, int num) {
		super(name);
		this.num = num;
	}
	
	public SearchTrack(int num) {
		this.num = num;
	}
	
	public SearchTrack() {
		super();
	}

	public SearchTrack(SearchArtist searchartist, String name) {
		super(name);
		this.searchartist = searchartist;
	}
	
	public SearchTrack(SearchArtist searchartist) {
		this.searchartist = searchartist;
	}
	
	public SearchTrack(SearchArtist searchartist, String name, int num) {
		super(name);
		this.num = num;
		this.searchartist = searchartist;
	}
	
	public SearchTrack(SearchArtist searchartist, int num) {
		this.num = num;
		this.searchartist = searchartist;
	}
	
	public SearchTrack(SearchArtist searchartist, SearchAlbum searchalbum, String name) {
		super(name);
		this.searchartist = searchartist;
		this.searchalbum = searchalbum;
	}
	
	public SearchTrack(SearchArtist searchartist, SearchAlbum searchalbum, String name, int num) {
		super(name);
		this.num = num;
		this.searchartist = searchartist;
		this.searchalbum = searchalbum;
	}

	public SearchTrack(SearchArtist searchartist, SearchAlbum searchalbum, int num) {
		this.num = num;
		this.searchartist = searchartist;
		this.searchalbum = searchalbum;
	}

	public SearchTrack(SearchArtist searchartist, SearchAlbum searchalbum) {
		this.searchartist = searchartist;
		this.searchalbum = searchalbum;
	}
	
	public SearchArtist getSearchArtist() { return searchartist; }
	public SearchAlbum getSearchAlbum() { return searchalbum; }
	
	/***
	 * 
	 * @param track
	 * @return true if track matches search criteria
	 */
	public boolean matches(Track track) {
		if (num != -1 && track.getNum() != num) {
			return false;
		}
		return super.matches(track);
	}
	
	public String toString() {
		String str = "";
		str += super.toString();
		if (num != -1) str += " - " + num;
		
		return str;
	}
}
